home *** CD-ROM | disk | FTP | other *** search
- #include "menu.h"
-
- #define BLACKONWHITE CREATE_VIDEO_ATTRIBUTE(white,black)
-
-
- int menu_routine();
-
- POPUP_MENU_ENTRY menu_items1[] = {
- " Load F3",1,'L',F3,menu_routine,
- " Pick Alt-F3",2, 'P',ALTF3,menu_routine,
- " New" ,3, 'N',0,menu_routine,
- " Save F2",4, 'S',F2,menu_routine,
- " Write to ",5, 'W',0,menu_routine,
- " Directory ",6, 'D',0,menu_routine,
- " Change Dir" ,7, 'C',0,menu_routine,
- " OS shell" ,8, 'O',0,menu_routine,
- " Quit Alt-X" ,9,'Q',ALTX,menu_routine,
- CWL_NULL,0};
-
-
-
- POPUP_MENU_ENTRY menu_items3[] = {
- " Run Ctrl-F9 ",1,'R',CTRLF9,menu_routine,
- " Program reset Ctrl-F2 ",2,'P',CTRLF2,menu_routine,
- " Go to Cursor F4 ",3,'G',F4,menu_routine,
- " Trace into F7 ",4,'T',F7,menu_routine,
- " Step over F8 ",5,'S',F8,menu_routine,
- " User screen Alt-F5 ",6,'U',ALTF5,menu_routine,
- CWL_NULL,0};
-
-
- POPUP_MENU_ENTRY menu_items4[] = {
- " Compile to OBJ ",1,'C',0,menu_routine,
- " Make EXE file ",2,'M',0,menu_routine,
- " Link EXE file ",3,'L',0,menu_routine,
- " Build all ",4,'B',0,menu_routine,
- " Primary C file: ",5,'P',0,menu_routine,
- " Get info ",6,'G',0,menu_routine,
- CWL_NULL,0};
-
-
- POPUP_MENU_ENTRY menu_items5[] = {
- " Project Name ",1,'P',0,menu_routine,
- " Break make on ",2,'B',0,menu_routine,
- " Auto dependencies ",3,'A',0,menu_routine,
- " Clear project ",4,'C',0,menu_routine,
- " Remove messages ",5,'R',0,menu_routine,
- CWL_NULL,0};
-
-
- POPUP_MENU_ENTRY menu_items6[] = {
- " Compiler ",1,'C',0,menu_routine,
- " Linker ",2,'L',0,menu_routine,
- " Environment ",3,'E',0,menu_routine,
- " Directories ",4,'D',0,menu_routine,
- " Arguments ",5,'A',0,menu_routine,
- " Save Options ",6,'S',0,menu_routine,
- " Retrieve options ",7,'R',0,menu_routine,
- CWL_NULL,0};
-
-
- POPUP_MENU_ENTRY menu_items7[] = {
- " Evaluate Ctrl-F4 ",1,'E',CTRLF4,menu_routine,
- " Call Stack Ctrl-F3 ",2,'C',CTRLF3,menu_routine,
- " Find Function ",3,'F',0,menu_routine,
- " Refresh display ",4,'R',0,menu_routine,
- " Display swapping Smart ",5,'D',0,menu_routine,
- " Source debugging ",6,'S',0,menu_routine,
- CWL_NULL,0};
-
-
- POPUP_MENU_ENTRY menu_items8[] = {
- " Add watch Ctrl-F7 ",1,'A',CTRLF7,menu_routine,
- " Delete watch ",2,'D',0,menu_routine,
- " Edit Watch ",3,'E',0,menu_routine,
- " Remove all watches ",4,'R',0,menu_routine,
- " Toggle breakpoint Ctrl-F8 ",6,'T',CTRLF8,menu_routine,
- " Clear all breakpoints ",7,'C',0,menu_routine,
- " View next breakpoint ",8,'V',0,menu_routine,
- CWL_NULL,0};
-
-
- BAR_MENU_ENTRY bar_items[] = {
- "File",1,4,'F',0,NULLFN,
- "Edit",1,10,'E',0,menu_routine,
- "Run",1,17,'R',0,NULLFN,
- "Compile",1,23,'C',0,NULLFN,
- "Project",1,33,'P',0,NULLFN,
- "Options", 1,43,'O',0,NULLFN,
- "Debug",1,53,'D',0,NULLFN,
- "Break/watch",1,61,'B',0,NULLFN,
- CWL_NULL};
- POPUP_MENU_ENTRY *pentry[] = {menu_items1, POPUP_NULL_ENTRY, menu_items3,
- menu_items4, menu_items5, menu_items6,
- menu_items7, menu_items8};
-
- unsigned menu_colors[5]; /* Menu colors */
- BAR_MENU_PTR bar; /* Pointer to bar menu */
- POPUP_MENU_PTR popups[8]; /* Array of pointers to popup menus */
- PULLDOWN_MENU_PTR pull; /* Pointer to pulldown menu */
-
- WPOINTER my_open(); /* Pointer to custom bar window open function */
- int popuprank[] = {1,1,1,1,1,1,1,1}; /* Ranks of popup windows */
- int popupstart[] = {1,1,1,1,1,1,1,1}; /* Starting option for each popup
- menu */
- int height[] = {9,0,6,6,5,7,6,8}; /* height of each window */
-
- WPOINTER pw; /* Misc. windows, not part of menu
- system */
-
- char *line =
- "─────────────────────────────"; /* Horizontal line */
-
-
- main()
- {
- int i;
- WindowInitializeSystem();
- WindowSaveInitial(0);
- pw = WindowInitialize(BORDER,5,10,70,5,BLACKONWHITE,BLACKONWHITE,
- SINGLEBOX);
- WindowOpen(pw);
- /* define colors */
- menu_colors[0] = CREATE_VIDEO_ATTRIBUTE(white,black);
- menu_colors[1] = CREATE_VIDEO_ATTRIBUTE(white,black);
- menu_colors[2] = CREATE_VIDEO_ATTRIBUTE(white,blue);
- menu_colors[3] = CREATE_VIDEO_ATTRIBUTE(cyan,black);
- menu_colors[4] = CREATE_VIDEO_ATTRIBUTE(white,black);
-
- bar = BarCreateMenu(bar_items, /* Array of BAR_MENU_ENTRY's */
- menu_colors,/* Pointer to menu colors */
- 6, /* Row to open bar menu window */
- 1, /* Column to open bar menu window */
- my_open); /* Customized window open function */
-
- /* Now set bar options */
-
- BarSetOptions(bar,BARWRAP | BARSTATIC,1); /* Wrap highlight bar */
-
- /* Now loop to create all popup menus
- Be careful and asign NULL to the second popup menu */
-
-
- for (i=0; i<8; i++) /* Loop for all popup menus */
- {
- if (pentry[i] != POPUP_NULL_ENTRY) /* Skip over NULL popup entry */
- {
- popups[i] =
- PopupCreateMenu(pentry[i], /* Array of POPUP_MENU_ENTRY's */
- menu_colors, /* Array of menu colors, */
-
- /* The next two arguments will later be ignored */
- 1, /* Row to open popup window on */
- 1, /* Column to open popup */
- height[i], /* height of the popup window */
- /* No custom window open
- functions */
- WNULLFN,
- VWNULLFN);
-
-
- /* Now set the popup menu options */
- PopupSetOptions(popups[i],POPUPWRAP | POPUPSTATIC,1); /* Wrap the
- window */
- }
- else
- popups[i] = (POPUP_MENU_PTR)0; /* Make this a null POPUP_MENU_PTR */
- } /* end for (i=0 ... */
- VirtualWriteString(popups[7]->w->vwptr,line,5,1); /* Draw horizontal line
- in virtual window */
-
- PopupMakeEntryUnavailable(popups[6],2); /* hide 2nd and 3rd entries in */
- PopupMakeEntryUnavailable(popups[6],3); /* popups[6] */
- PopupSetOptions(popups[6],POPUPOVERRIDE,1);
-
- pull = PulldownCreateMenu(popups,bar,1);
- PulldownSelectMenu(pull,1,1,popuprank,popupstart,1);
- PulldownMenuFree(pull);
- }
-
- int menu_routine(PULLDOWN_MENU_PTR p, BAR_MENU_PTR b, POPUP_MENU_PTR pop,
- int hs, int vs)
- {
- int ch;
- WindowClear(pw);
- WindowPrintf(pw,
- "You have selected bar option %d vertical option %d\n",hs,vs);
- WindowWriteCenterString(pw,"Press Escape to Quit",3);
- WindowWriteCenterString(pw,"Press any other key to continue...",4);
- WindowDisplay(pw,1,NOEFFECT);
- ch = GET_KEY();
- WindowHide(pw,NOEFFET);
- if (ch == ESC)
- return PULLDOWN_EXIT;
- return PULLDOWN_CONTINUE;
- }
-
-
- WPOINTER my_open() /* Custom window open function for bar menu */
- {
- WPOINTER w;
- w = WindowInitialize(NOBORDER,1,1,80,1,BLACKONWHITE,BLACKONWHITE,"");
- WindowOpen(w);
- return w;
- }